import { _decorator, Component, Node, Button } from 'cc';
import { GameManager } from './GameManager';
const { ccclass, property } = _decorator;

@ccclass('SuccessPanelController')
export class SuccessPanelController extends Component {
    @property(Button)
    nextLevelBtn: Button = null;

    start() {
        // 添加按钮点击事件监听
        if (this.nextLevelBtn) {
            this.nextLevelBtn.node.on(Button.EventType.CLICK, this.onNextLevelClick, this);
        }
    }

    onDestroy() {
        // 清理事件监听
        if (this.nextLevelBtn && this.nextLevelBtn.node) {
            this.nextLevelBtn.node.off(Button.EventType.CLICK, this.onNextLevelClick, this);
        }
    }

    private onNextLevelClick() {
        GameManager.instance.loadNextLevel();
    }
} 